package com.yanqu.road.dao.impl.logic;

import com.alibaba.fastjson.JSONObject;
import com.yanqu.road.entity.servercenter.ProcessInfo;

public class ProcessInfoParser {
    public static ProcessInfo parsingProcessInfo(String infoStr, int serverId) {
        ProcessInfo info = new ProcessInfo();
        info.setServerId(serverId);

        JSONObject jObject = JSONObject.parseObject(infoStr);
        info.setServerName(jObject.getString("serverName"));
        info.setServerIndex(jObject.getIntValue("serverIndex"));
        info.setName(jObject.getString("name"));
        info.setAddress(jObject.getString("address"));
        info.setPort(jObject.getIntValue("port"));
        info.setAdminPort(jObject.getIntValue("adminPort"));
        return info;
    }
}
